package cn.icanci.learn.v2;

import cn.icanci.learn.v2.study.ComponentA;
import cn.icanci.learn.v2.study.ComponentB;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Tips: 第1课 使用ClassPathXmlApplicationContext的方式解析bean
 *
 * @author icanci
 * @date Created in 2021/06/08 00:49
 * @version 1.0
 */
@SuppressWarnings("all")
public class ClassPathXmlApplicationContextMain {
	public static void main(String[] args) {
		// 面向接口编程 最终是 ApplicationContext
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-bf.xml");
		ComponentA componentA = (ComponentA) applicationContext.getBean("componentA");
		ComponentB componentB = (ComponentB) applicationContext.getBean("componentB");

		System.out.println(componentA);
		System.out.println(componentB);
	}
}
